<?php

$KeyMd5 = "9e7a243931d8c7d28a7b7398452f7a15";
$IDCodSMS = 19637;
$FileDir = "./";
$FileExtension = ".smstarget.txt";

$RandID = "1281130576_469115463";
$FilePath = $FileDir . "/" . $RandID . $FileExtension;

//-----------------------------------------------------------------------------------------------

$smstipodest=30; // static setting
$tptarget=1; // static setting
$UrlCliente="www.alessandropolo.name/wosh/smsc.php";

//-----------------------------------------------------------------------------------------------

$number_prefix=$_GET["prefix"];
$number_target=$_GET["number"];
$sender=$_GET["sender"];
$message=$_GET["message"];

$number_prefix=htmlentities(stripslashes($number_prefix));
$number_target=htmlentities(stripslashes($number_target));
$sender=htmlentities(stripslashes($sender));
$message=htmlentities(stripslashes($message));

$variabili ="UrlCliente=http://".$UrlCliente."&";
$variabili.="smstipodest=$smstipodest&";
$variabili.="smsprefcell=$number_prefix&";
$variabili.="smsdestinatario=$number_target&";
$variabili.="smsmittente=$sender&";
$variabili.="smstesto=$message&";
$variabili.="smsnumdest=$number_target&";
$variabili.="PathReferer=$UrlCliente&";
$variabili.="RandID=$RandID&";
$variabili.="RiepilogoFatto=SI&";
$variabili.="IDCodSMS=$IDCodSMS&";
$variabili.="tptarget=$tptarget&";
$variabili.="smsflash=$smsflash&";
$variabili.="smspubblicit=$smspubblicit&";
$variabili.="Mittente=62%2E149%2E141%2E105&";
$variabili.="HttpPathReferer=&";

//-----------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------

function sendToHost($path,$data) {
	$fp = fsockopen("sms.aruba.it",80);
	if (!$fp) {
		echo "$errstr ($errno)<br />\n";
	 }
	else {
		fputs($fp, "POST " .$path. " HTTP/1.1\r\n");
		fputs($fp, "Host: sms.aruba.it\r\n");
		fputs($fp, "Referer: http://$UrlCliente\r\n");
		fputs($fp, "Content-Type: application/x-www-form-urlencoded\r\n");
		fputs($fp, "Content-length: " . strlen($data) . "\r\n");
		fputs($fp, "Connection: close\r\n\r\n");
		fputs($fp, $data);
		while (!feof($fp)) $buf .= fgets($fp,128);
		fclose($fp);
	}
	return $buf;
 }

$variabili ="UrlCliente=http://".$UrlCliente."&";
$variabili.="smstipodest=$smstipodest&";
$variabili.="smsprefcell=$number_prefix&";
$variabili.="smsdestinatario=$number_target&";
$variabili.="smsmittente=$sender&";
$variabili.="smstesto=$message&";
$variabili.="smsnumdest=$number_target&";
$variabili.="PathReferer=$UrlCliente&";
$variabili.="RandID=$RandID&";
$variabili.="RiepilogoFatto=SI&";
$variabili.="IDCodSMS=$IDCodSMS&";
$variabili.="tptarget=$tptarget&";
$variabili.="smsflash=0&";
$variabili.="smspubblicit=0&";
$variabili.="Mittente=WOSH&";
$variabili.="HttpPathReferer=&";
$variabili.="RespoID=";

//-----------------------------------------------------------------------------------------------
header('Content-Type: text/plain');

echo $variabili;

echo "\r\n ------------------\r\n";

$res = sendToHost("/SmsSender/Default.aspx",$variabili);
echo $res;
?>